<?php
    class provider_view_controller extends controllerBase
    {
        public function process()
        {
            $oDatabase = new database();
            $sQuery = "SELECT * FROM producers WHERE producer_alias = '".$this->iId."'";
            $oProvider = $oDatabase->getObject($sQuery);
            
            $sQuery = 'PREFIX foaf: <http://xmlns.com/foaf/0.1/>
            PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
            PREFIX dc: <http://purl.org/dc/elements/1.1/>
            PREFIX bus: <'.URL::getLink('id/bussiness#').'>

            SELECT * 
            WHERE
            {
            ?uri rdf:type bus:product.
            ?uri bus:name ?name.
            OPTIONAL{?uri bus:isHightLight ?isHightLight.}
            OPTIONAL {?uri bus:ownUser ?user.
            ?user foaf:familyName ?ownUser.}.
            ?uri bus:defaultImage ?image.
            ?uri bus:price ?price.
            ?uri bus:description ?description.
            ?uri bus:publishTime ?time.
            }
            ORDER BY DESC(?time)';
            $aProducts = $oDatabase->loadRemoteQuery($oProvider->producer_endpoint,$sQuery);
            $this->aParams['aProducts'] = $aProducts;
        }
    }
?>
